home *** CD-ROM | disk | FTP | other *** search
- Path: cdshub.cdc.com!usenet
- From: Jesper Bagger <Jesper.Bagger@cdc.com>
- Newsgroups: comp.lang.c++
- Subject: Re: using c & c++ with Solaris
- Date: 2 Feb 1996 15:29:41 GMT
- Organization: Control Data Denmark
- Message-ID: <4etal5$fp4@cdshub.cdc.com>
- References: <4em295$q5d@data.wcupa.edu>
- NNTP-Posting-Host: 129.179.133.82
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
- William writes:
-
- >I'm fairly new at using unix for c programming, and though this question
- >may reflect my newbie-ness, would anyone be so kind as to pardon my green
- >aura(?): if C++ is a superset of "C", why does "cc" (object oriented
- >compiler) choke when I sent it "C" language commands (like "printf")?
- >Should not all the libraries (etc.) be there? Or is this a system specific
- >problem (ie. - "specifically MY system?")
-
- I dont no if it solves your problem, but if you want to use c-library functions in C++,
- you should include the header files with:
-
- extern "C" {
- #include <stdlib.h>
- }
-
- As far as I know, all header files on Solaris test whether or not CPLUSPLUS is defined,
- and add the "extern" declaration if needed. In that case you can write:
-
- #include <stdlib.h>
-
- in order to get a prototype of printf.
-
- With regards
-
- Jesper Bagger
- Control Data Denmark A/S
-
-
-